<div class="dux-tools">
  <div class="bread-head">扩展模型管理 <span class="small">将栏目与扩展模型进行绑定来实现附加字段功能</span> </div>
  <br>
  <div class="tools-function clearfix">
    <div class="float-left"> <a class="button button-small bg-main icon-list" href="__URL__"> 模型列表</a> </div>
    <?php if(model('user_group')->model_power('fragment','add')){ ?>
    <div class="button-group float-right"> <a class="button button-small bg-dot icon-plus dropdown-toggle"> 添加模型 <span class="downward"></span></a>
      <ul class="drop-menu pull-right">
      <?php if(model('user_group')->model_power('expand_model','add')){ ?>
        <li><a href="javascript:;" onclick="add()">添加模型</a></li>
       <?php } ?> 
      </ul>
    </div>
   <?php } ?>
  </div>
</div>
<div class="admin-main"> 
  <!--管理员列表-->
  <div class="panel dux-box">
    <div class="table-responsive">
      <table id="table" class="table table-hover ">
        <tbody>
          <tr>
            <th width="80">编号</th>
            <th width="*">模型名称</th>
            <th width="*">模型数据表</th>
            <th width="150">模型操作</th>
          </tr>
          <!--foreach:{$list $vo}-->
          <tr>
            <td>{$vo.mid}</td>
            <td>{$vo.name}</td>
            <td>{$vo.table}</td>
            <td>
            <?php if(model('user_group')->model_power('expand_model','edit')){ ?>
            <a class="button bg-blue button-small icon-th" href="__URL__/field_list/mid-{$vo.mid}" title="字段管理"></a>
             <a  href="javascript:void(0);" onclick="edit('{$vo.mid}')" class="button bg-blue button-small icon-pencil" title="修改"></a>
                <?php } ?>
                 <?php if(model('user_group')->model_power('expand_model','del')){ ?>
                <a class="button bg-red button-small icon-trash-o js-del" href="javascript:void(0);" onClick="del('{$vo.id}',this)" title="删除"></a>
                <?php } ?></td>
          </tr>
          <!--{/foreach}-->
        </tbody>
      </table>
    </div>
  </div>
</div>
<script>
//添加
function add() {
	urldialog({
	title:'模型添加',
	url:'__URL__/add'
	});
};
//修改
function edit(url) {
	urldialog({
	title:'模型编辑',
	url:'__URL__/edit/mid-'+url
	});
};
function model_in(url) {
	urldialog({
	title:'模型导入',
	url:url
	});
};
function out(mid) {
	ajaxpost({
		name:'导出的文件将在网站目录下的"data/ext_module"中，请自行下载！',
		url:"__URL__/out",
		data:{mid:mid},
		tip:1
	});
};
//删除
function del(mid,obj) {
	var obj;
	ajaxpost({
		name:'删除模型后会同时删除模型表和内容! ',
		url:"__URL__/del",
		data:{mid: mid},
		tip:1,
		success:function(){
			$(obj).parent().parent().remove();
		}
	});
}
</script>